const {merge} = require('webpack-merge') // 引入webpack-merge功能模块
const common = require('./webpack.base.js') // 引入webpack.common.js
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
// const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');

module.exports = merge(common, {
  // 将webpack.common.js合并到当前文件
  devServer: {
    contentBase: '../dist', // 本地服务器所加载文件的目录
    port: '8008', // 设置端口号为8088
    inline: true, // 文件修改后实时刷新
    historyApiFallback: true, //不跳转
    hot: true, // 热更新
    open:true, 
  },
  mode: 'development', // 设置mode
  plugins: [
    new BundleAnalyzerPlugin({
        analyzerMode: process.env.ANALYZE === 1 ? 'server':'disabled',
        generateStatsFile: true,
        statsOptions: { source: false }
      }),
  ]
})